package com.atm.mapper;

import com.atm.entity.Account;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.Date;

public interface AccountMapper extends BaseMapper<Account> {
    @Update("update account set remainAmount=remainAmount+#{param2},lastTime=#{param3} where accountNo = #{param1}; ")
    int deposit(String accountNo, Long depositAmount, Date lastTime);
    @Update("update account set remainAmount=remainAmount-#{param2},lastTime=#{param3} where accountNo = #{param1};")
    int cash(String accountNo, Long cashAmount, Date lastTime);
    @Select("select username from account a inner join user b on a.userId = b.userId where accountNo=#{param1};")
    String selectByAccountNo(String accountNo);
}
